package com.ceb.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author name:dss
 * @version 1.0
 * @description: TODO
 * @date 2022/8/232022/8/23
 */
public class MyInvocationHandler implements InvocationHandler {

    //真实类
    private Object target;

    public MyInvocationHandler(Object target){
        this.target=target;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("[日志]执行了"+method.getName()+"方法");
        Object invoke = method.invoke(target);
        System.out.println("[日志]执行"+method.getName()+"结束");

        return invoke;
    }
}
